package com.ruoyi.business.service;

import org.activiti.engine.RuntimeService;
import org.activiti.engine.history.HistoricActivityInstance;
import org.activiti.engine.history.HistoricProcessInstance;
import org.activiti.engine.history.HistoricTaskInstance;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;

import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;

public interface IProcessService {
     Deployment deploy(String filePath) throws FileNotFoundException;

    ProcessDefinition selectProcessDefinitionByDeploymentId(String deploymentId);

    InputStream getResourceAsStream(String deploymentId, String resourceName);

    InputStream getProcessImage(String processDefinitionId,
                                List<String> highLightedActivities,
                                List<String> highLightedFlows);

    ProcessInstance deployByCarPackAgeAuditKey(String definitionKey, String packageKey, Map<String, Object> map);

    Task taskNameByProcessInstanceId(ProcessInstance processInstance);


    void addUser(Task task, Long userId);

    Task selectTeakByInstanceId(String instanceId);

    List<String> getActiceActivitiyids(String instanceId);

    ProcessInstance selectRunTimeServiceByiNstanceId(Long instanceId);

    void deleteByInstanceId(Long instanceId);

    long getTodoPageCount(String definitionKey ,String candidateUser);

    List<Task> selectTodoTaskList(String definitionKey, String candidateUser, int pageNum, int pageSize);

    ProcessInstance getProcessInstanceById(String processInstanceId);

    /**
     * 根据任务id查询任务对象
     * @param taskId
     * @return
     */
    Task getTaskByTaskId(String taskId);

    /**
     * 给任务添加批注,设置流程变量,认领任务，完成任务
     * @param task
     * @param toString
     * @param auditstatusBoolean
     * @param commentStr
     */
    void claimAndComplateTask(Task task, String toString, boolean auditstatusBoolean, String commentStr);

    void setVariable(String taskId, String key, long value);

    Task getTaskByInstanceId(String processInstanceId);

    long selectDoneTaskCount(String definitionKey, String candidateUser);

    List<HistoricTaskInstance> selectDoneList(String definitionKey, String candidateUser, Integer beginIndex, Integer pageSize);

    HistoricProcessInstance getHistoricProcessInstanceById(String processInstanceId);

    List<HistoricActivityInstance> selectHistoryTaskList(String instanceId);

    String getTaskComment(String taskId);
}
